const { Service } = require("egg");
class NewsService extends Service {
  async list(pageNum, pageSize) {
    const { ctx } = this;
    // 通过配置文件获取新闻列表接口地址
    const { newsListUrl } = this.config.news;
    const result = await ctx.curl(newsListUrl, {
      method: "GET",
      data: {
        pageNum,
        pageSize,
      },
      dataType: "json",
    });
    return result.data.data;
  }
}
module.exports = NewsService;
